<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="contextPath" value="${pageContext.servletContext.contextPath}"></c:set>
<!DOCTYPE html>
<html lang="zn_cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="${contextPath }/css/bootstrap.css" />
<script type="text/javascript" src="${contextPath }/js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="${contextPath }/js/bootstrap.js"></script>
<script type="text/javascript">
	function deleteaccount(){
		test.submit();
	}
	function selectAll(){
		var checklist = document.getElementsByName ("bookid");
		if(document.getElementById("bookidAll").checked){
		  	for(var i=0;i<checklist.length;i++){
		     	checklist[i].checked = true;
		  	 } 
		}else{
		  	for(var j=0;j<checklist.length;j++){
		    	checklist[j].checked = false;
		 	}
		}
	}
</script>
<title>出版社信息</title>
</head>
<body>
	<div class="container">
		<div class="row">
				<div class="col-md-12">
			<img src="${contextPath }/img/115.jpg" />
				</div>
		</div>

		<div class="row"
			style="background-image: url('${contextPath }/img/top01.gif'); background-repeat: repeat-x; height: 40px">
			<div class="col-md-5">
				<img src="${contextPath }/img/icon1.gif" />所有出版社：
			</div>
			<div class="col-md-2" style="float:right">
				<button type="button" class="btn btn-link " data-toggle="modal"
						data-target="#newpublisher">添加新的出版社</button>
			</div>
		</div>
		
		
			<div class="table-responsive">
			<form id="test" action="deleteaccount.do" method="post">
				<c:if test="${publisherlist.size() != 0}">
				<table id="mytable" class="table table-hover" style="text-align: center">
				<tr>
					<td>出版社编号</td>
					<td>出版社名称</td>
					<td>操作</td>
				</tr>
					<c:forEach var="item" varStatus="status" items="${publisherlist}">
						<tr>
							<td><input type="checkbox" name="bookid" value="${item.id}"/></td>
							<td>${item.name}</td>				
							<td><a href="${contextPath }/delpublisher.htm?id=${item.id}">删除</a></td>
						</tr>
				</c:forEach>
					<tr>
						<td><input type="checkbox" onclick="selectAll()" id="bookidAll"/>全选</td>
						<td>
							<a href="#" style="float:left" onclick="deleteaccount()">删除选中项</a>
						</td>
					</tr>
				</table>
				</c:if>
				<c:if test="${ publisherlist.size() == 0}">
					<h2 align="center">没有记录</h2>
				</c:if>
				</form>
			</div>
			
		
	<div class="modal fade" id="newpublisher" aria-labelledby="myModalLabel"
	aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">添加出版社</h4>
			</div>
			<div class="modal-body"></div>
			<center>
				<form role="form" action="addpublisher.htm" method="post">
					<div class="form-group">
						出版社编号： <input type="text" class="form-control" placeholder="输入出版社编号"
							name="publisherid" style="width: 300px;">
					</div>
					<div class="form-group">
						出版社名称： <input type="text" class="form-control" placeholder="输入出版社名称" name="publishername"
							style="width: 300px;">
					</div>
					<button type="submit" class="btn btn-default">添加</button>
				</form>
			</center>
		</div>
	</div>
</div>
</body>
</html>